﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Zove.Runtime.Core;
using Zove.Runtime.Core.Zoom;

namespace Zove.Runtime.Test {

    [TestClass]
    public class DefaultRuntimeModelLoaderTest {

        private DefaultRuntimeModelLoader loader = null;

        [TestInitialize()]
        public void Setup() {
            ZoomClassFinder f = new ZoomClassFinder();
            DefaultClassLoader l = new DefaultClassLoader(new ZoomLanguageNature());
            l.ClassFinder = f;
            loader = new DefaultRuntimeModelLoader(new ZoomLanguageNature());
            loader.ClassLoader = l;
        }

        [TestMethod]
        public void TestLoadByClassName() {
            ZoomLanguageNature languageNature = new ZoomLanguageNature();
            ZoomClass zc = languageNature.ClassLoader.LoadByClassName("circle");
            
            Assert.AreEqual(4, zc.Variables.Count);
        }

        [TestMethod]
        public void TestLoadBySource() {
        }

        [TestMethod]
        public void TestLoadByUrl() {
        }

        [TestCleanup()]
        public void TearDown() {
        }

        [TestMethod]
        public void TestRecursive() {
            loader.LoadByClassName("Triangle");
            loader.LoadByClassName("RightTriangle");
        }
    }
}
